home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / 42 ƒ / LifeModule.h < prev    next >
Encoding:
Text File  |  1999-06-25  |  3.5 KB  |  149 lines  |  [TEXT/CWIE]

  1. //
  2. // File:        LifeModule.h
  3. // Contains:    Interface definitions for life plug in modules
  4. // Written by:    Douglas Clarke
  5. // Copyright:    @ 1992-1997 by Apple Computer, Inc., all rights reserved.
  6. //                <1> 04/25/97    DGC    First check in
  7. //
  8.  
  9. ////////////////////////////////////////////////////////////////////////
  10. //
  11. //    PICreateLife
  12. //
  13. //  This routine creates the life data structure
  14. //
  15. //  Inputs:
  16. //            ThePrivateData    A zero length handle place holder
  17. //            sizeX              the number of cells across (1 based)
  18. //            sizeY            the number of cells up and down (1 based)
  19. //            cellSizeX        the number of pixels wide a cell pict is
  20. //            cellSizeY        the number of pixels tall a cell pict is
  21. //            theWindow        a window large enough to hold the cells drawn as Pict
  22. //            alivePict        True to measure while PM is set
  23. //
  24. //  Outputs:
  25. //            error code if any
  26.  
  27.  
  28. OSErr PICreateLife(Handle ThePrivateData,
  29.                 unsigned long    *life_base,
  30.                 short rowbytes,
  31.                 long color);
  32.  
  33. ////////////////////////////////////////////////////////////////////////
  34. //
  35. //    PITrashLife
  36. //
  37. //  This routine cleans up the life game data.
  38. //    all handles and pointers alocated by the plugin must be deisposed of
  39. //    the size of ThePrivateData is to be set back to zero and unlocked
  40. //
  41. //  Inputs:
  42. //            ThePrivateData    the life plugins data
  43. //
  44. //  Outputs:
  45. //            error code if any
  46.  
  47. OSErr PITrashLife(Handle ThePrivateData);
  48.  
  49. ////////////////////////////////////////////////////////////////////////
  50. //
  51. //    PISetACell
  52. //
  53. //  This routine cleans up the life game data.
  54. //    all handles and pointers alocated by the plugin must be deisposed of
  55. //    the size of ThePrivateData is to be set back to zero and unlocked
  56. //
  57. //  Inputs:
  58. //            ThePrivateData    the life plugins data
  59. //            x                zero based right offset to cell
  60. //            y                zero based down offset to cell
  61. //            state            true = alive
  62. //
  63. //  Outputs:
  64. //            error code if any
  65.  
  66. OSErr PISetACell(Handle ThePrivateData,long x, long y, Boolean state);
  67.  
  68. ////////////////////////////////////////////////////////////////////////
  69. //
  70. //    PIDrawACell
  71. //
  72. //  This routine draws one cell to the window.
  73. //  an alive cell is drawn with a pict
  74. //  a dead cell is erased
  75. //
  76. //  Inputs:
  77. //            ThePrivateData    the life plugins data
  78. //            x                zero based right offset to cell
  79. //            y                zero based down offset to cell
  80. //
  81. //  Outputs:
  82. //            error code if any
  83.  
  84. OSErr PIDrawACell(Handle ThePrivateData,long x, long y);
  85.  
  86. ////////////////////////////////////////////////////////////////////////
  87. //
  88. //    PIReadACell
  89. //
  90. //  This routine returns the state of one cell
  91. //
  92. //  Inputs:
  93. //            ThePrivateData    the life plugins data
  94. //            x                zero based right offset to cell
  95. //            y                zero based down offset to cell
  96. //
  97. //  Outputs:
  98. //            true of cell is alive
  99.  
  100. Boolean PIReadACell(Handle ThePrivateData,long x, long y);
  101.  
  102. ////////////////////////////////////////////////////////////////////////
  103. //
  104. //    PINextGeneration
  105. //
  106. //  This routine runs through each cell and adjusts its state
  107. //
  108. //  Inputs:
  109. //            ThePrivateData    the life plugins data
  110. //
  111. //  Outputs:
  112. //            error code if any
  113.  
  114. OSErr PINextGeneration(Handle ThePrivateData);
  115.  
  116. ////////////////////////////////////////////////////////////////////////
  117. //
  118. //    PIDrawBoard
  119. //
  120. //  This routine runs through each cell and draws it
  121. //
  122. //  Inputs:
  123. //            ThePrivateData    the life plugins data
  124. //
  125. //  Outputs:
  126. //            error code if any
  127.  
  128. OSErr PIDrawBoard(Handle ThePrivateData);
  129.  
  130.  
  131. ////////////////////////////////////////////////////////////////////////
  132. //
  133. //    PISetColor
  134. //
  135. //  This routine tells the module what color to draw the cells
  136. //
  137. //  Inputs:
  138. //            RGBColor aColor
  139. //
  140. //  Outputs:
  141. //            void
  142.  
  143. void PISetColor(Handle ThePrivateData, long color);
  144.  
  145.  
  146.  
  147.  
  148.  
  149.